<?php



namespace App\Http\Requests\Company;

use App\Http\Requests\Company\BaseRequest;
use Illuminate\Support\Facades\Auth;

class CompanyCategoryRequest extends BaseRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [

            'name' => 'required',
        ];
    }

    public function messages()
    {
        return [

            'name.required' => __('请输入分类名'),
        ];
    }

    public function filldata()
    {
        $user = Auth::user();
        return [

            'name' => $this->input('name'),
            'parent_id' => (int)$this->input('parent_id', 0),
            'user_id' => (int)$user['id'],
            'company_id'=>(int)$user['login_company_id']


        ];
    }
}
